package com.hxx.util;

import java.util.UUID;
import java.util.zip.CRC32;

public class HxxUtils {

    public static int generateId() {
        String uuid = UUID.randomUUID().toString();
        CRC32 crc32 = new CRC32();
        crc32.update(uuid.getBytes());
        //会出现负数，需要转成int
        return (int) crc32.getValue();
    }

    public static String generateIdString() {
        String uuid = UUID.randomUUID().toString();
        return uuid.replaceAll("-", "");
    }
}
